import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/components/Home'
import Login from '@/components/Login'
import StudentOverview from '@/components/students/StudentOverview'
import Kong from '@/components/homeComponents/Kong'
import StudentEvaluate from '@/components/students/StudentEvaluate'
import StudentPunishment from '@/components/students/StudentPunishment'
import TeacherWork from '@/components/teachers/TeacherWork'
import Set from '@/components/boss/Set'
import Del from '@/components/boss/Del'
import Money from '@/components/boss/Money'
import About from '@/components/boss/About'
import Sty from '@/components/djy/Sty'
import Richeng from '@/components/djy/Richeng'
import BeonDuty from '@/components/BeonDuty/BeonDuty'
import theSet from '@/components/theSet/TheSet'

Vue.use(Router)

// 处理vue-router3.0以上版本重复点击报错
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
   return originalPush.call(this, location).catch(err => err)
}

export default new Router({
	routes: [{
			path: '/',
			redirect: '/login',
			hidden: true,
			component: Login
		},
		{
			path: '/login',
			name: 'Login',
			hidden: true,
			component: Login,
		},
		{
			path: '/home',
			name: '主页',
			component: Home,
			meta: {
				requireAuto: true
			},
			children: [{
					path: '/home/students',
					name: '学生管理列表',
					component: Kong,
					meta: {
						requireAuto: true
					},
					children: [{
							path: '/home/students/overview',
							name: '学生总览',
							component: StudentOverview,
							meta: {
								requireAuto: true
							},
						},
						{
							path: '/home/students/late',
							name: '学生迟到情况',
							meta: {
								requireAuto: true
							},
						},
						{
							path: '/home/students/evaluate',
							name: '学生评价',
							component: StudentEvaluate,
							meta: {
								requireAuto: true
							},
						},
						{
							path: '/home/students/punishment',
							name: '学生处分记录',
							component: StudentPunishment,
							meta: {
								requireAuto: true
							},
						}
					]
				},
				{
					path: '/home/teachers',
					name: '教师管理列表',
					component: Kong,
					meta: {
						requireAuto: true
					},
					children: [{
							path: '/home/teachers/list',
							name: '教师队伍列表',
							components: Sty,
							meta: {
								requireAuto: true
							},
						},
						{
							path: '/home/teachers/reception',
							name: '前台排班安排',
							component: BeonDuty,
							meta: {
								requireAuto: true
							},
						},
						{
							path: '/home/teachers/work',
							name: '教师工作安排',
							component: TeacherWork,
							meta: {
								requireAuto: true
							},
						}
					]
				}
			]
		},
		{
			path: '/boss',
			name: '员工详情',
			component: Home,
			meta: {
				requireAuto: true
			},
			children: [{
					path: '/boss/operation',
					name: '员工管理设置',
					component: Kong,
					meta: {
						requireAuto: true
					},
					children: [{
							path: '/boss/operation/set',
							name: '员工帐号添加',
							component: Set,
							meta: {
								requireAuto: true
							},
						},
						{
							path: '/boss/operation/del',
							name: '员工帐号删除',
							component: Del,
							meta: {
								requireAuto: true
							},
						}
					]
				},
				{
					path: '/boss/details',
					name: '员工详情',
					component: Kong,
					children: [{
							path: '/boss/details/money',
							name: '员工薪资表',
							component: Money,
						},
						{
							path: '/boss/details/about',
							name: '员工在职时间表',
							component: About,
							meta: {
								requireAuto: true
							},
						}
					]
				}
			]
		},
		{
			path: '/working',
			name: '个人工作日历',
			component: Home,
			meta: {
				requireAuto: true
			},
			children: [{
				path: '/working/set',
				name: '设置',
				component: Kong,
				meta: {
					requireAuto: true
				},
				children: [{
						path: '/working/setting/set',
						name: '个人设置',
						component: Richeng,
						meta: {
							requireAuto: true
						},
					},
					{
						path: '/home/working/setting/data',
						name: '设置',
						meta: {
							requireAuto: true
						},
					}
				]
			}]
		},
	],
	mode: 'history'
})
